﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Collections.Specialized;
using System.Runtime.Serialization;

namespace PMisuseAn.io
{
    [Serializable()]
    public class PolicyStatementDB : ISerializable
    {
        public string policyStatement;
        public string transmissionPrinciple;
        public string policyID;
        public string clusterName;


        //Default constructor
        public PolicyStatementDB(string policyStatement_, string transmissionPrinciple_, string policyID_)
        {
            policyStatement = policyStatement_;
            transmissionPrinciple = transmissionPrinciple_;
            policyID = policyID_;
            clusterName = MainWindow.clusterName;
        }

        //Deserialization constructor.
        public PolicyStatementDB(SerializationInfo info, StreamingContext ctxt)
        {
            //Get the values from info and assign them to the appropriate properties
            clusterName = (string)info.GetValue("projectClusterName", typeof(string));
            policyStatement = (string)info.GetValue("policyStatement", typeof(string));
            policyID = (string)info.GetValue("policyID", typeof(string));
            transmissionPrinciple = (string)info.GetValue("transmissionPrinciple", typeof(string));
        }
        
        //Serialization function.
        public void GetObjectData(SerializationInfo info, StreamingContext ctxt)
        {
            info.AddValue("projectClusterName", clusterName);
            info.AddValue("policyStatement", policyStatement);
            info.AddValue("policyID", policyID);
            info.AddValue("transmissionPrinciple", transmissionPrinciple);
        }

    }
}
